﻿Partial Public Class RegistrarTA
    Inherits System.Web.UI.Page

    Dim ocnTrabajoFinal As New CapaNegocio.TrabajoFinal()


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        cargargrilla(Me.TextBoxNroExpediente.Text)
    End Sub

    Function cargargrilla(ByVal nroExpediente As String)
        Dim ds As New DataSet

        ds = ocnTrabajoFinal.obtenerTrabajosAprobados(nroExpediente)

        Me.GridViewTrabajos.DataSource = ds.Tables(0)

        Me.GridViewTrabajos.DataBind()
        Return Me.GridViewTrabajos
    End Function


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Try
            ocnTrabajoFinal.InsertarNroResolucionTA(Me.TextBoxNroResolucionTA.Text _
                                                            , Me.TextBoxNroExpediente.Text _
                                                            , CDate(Me.TextBoxFecha.Text))
            cargargrilla(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try
    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
        Try
            cargargrilla(Me.TextBoxNroExpediente.Text)
        Catch ex As Exception
            Session.Add("exError", ex)
            Response.Redirect("ManejarError.aspx")
        End Try
    End Sub
End Class